package org.gd136.ce.script.impl;

import org.gd136.ce.script.Script;
import org.gd136.ce.script.ScriptStage;
import org.gd136.ce.util.StringUtil;

public class DelayScript extends Script {

	float delayTime;

	@Override
	public Script readScript(String scriptLine) {
		DelayScript ds = null;
		if (scriptLine.startsWith("==")) {
			ds = new DelayScript();
			ds.delayTime = StringUtil.parseFloat(scriptLine.substring(2), 0.5f);
			ds.addToPoolAndLinkFrontScript();
		}
		return ds;
	}

	@Override
	public void execute(ScriptStage stage) {
		stage.delay(delayTime);
	}

}
